package com.rongzhe.house.manager;

import com.rongzhe.house.entity.LifeServiceBanner;
import com.rongzhe.house.entity.voo.Banner;
import com.rongzhe.house.internet.DataListener;
import com.rongzhe.house.internet.InternetRequestWorker;
import com.rongzhe.house.internet.ResponseDispatcher;
import com.rongzhe.house.internet.net.BannerInterface;

import java.util.List;

/**
 * Created by huang on 2017/11/24.
 */

public class BannerManager {
    private BannerManager() {
    }
    private static BannerManager sInstance;
    public static BannerManager getInstance() {
        if (sInstance == null) {
            sInstance = new BannerManager();
        }
        return sInstance;
    }
    public void getBanners(String provienceId, DataListener<List<Banner>> dataListener) {
        InternetRequestWorker.getInstance().asyncNetwork(InternetRequestWorker.getInstance()
                .create(BannerInterface.class).getBinnerInfos(provienceId),
                new ResponseDispatcher(dataListener));
    }

    public void getBannersLifeService(int type,
                                      DataListener<List<LifeServiceBanner>> dataListener) {
        InternetRequestWorker.getInstance().asyncNetwork(InternetRequestWorker.getInstance()
                        .create(BannerInterface.class).getBinnerLifeService(type),
                new ResponseDispatcher(dataListener));
    }
}
